<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see IndustryController
 */
class IndustryController extends BaseController
{

    /**
     * add
     * @uri /industry/add
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"name":"CEA47ECDC060A85B"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function add(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * getList
     * @uri /industry/list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"page":"B762CB47E4C606E6"}
     * @response {"success":true,"statusCode":200,"result":{"total_count":10,"page_size":20,"page":1,"list":[{"id":1,"name":"\u5176\u4ed6","is_other":1}]},"message":"OK"}
     */
    public function getList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"total_count":10,"page_size":20,"page":1,"list":[{"id":1,"name":"\u5176\u4ed6","is_other":1}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}